package com.srit.vgt.controller;

import com.srit.vgt.common.response.Response;
import com.srit.vgt.common.response.VgtPage;
import com.srit.vgt.service.IMarketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//@RequestMapping("/")
@Api(tags = "market area")
public class MarketController {
    @Autowired
    IMarketService marketService;

    @GetMapping("/market/all")
    @ApiOperation("分页查询所有的market")
    public Response allMarket(VgtPage vgtPage, String cityId, String districtId) {
        return Response.success(marketService.allMarket(vgtPage, cityId, districtId));
    }


    @GetMapping("/market/{id}")
    @ApiOperation("id 返回最近七天的交易量")
    public Response marketById(@PathVariable String id) {
        return Response.success(marketService.marketById(id));
    }


    @GetMapping("/area")
    @ApiOperation("所有地区")
    public Response areaAll() {
        return Response.success(marketService.areaAll());
    }

}
